This guide is written quite roughly, but succinctly.

===========
CMD primer.
===========
To access the cmd prompt, press Winkey+R and type "cmd" and then enter or
open up the start menu and type "cmd" and "CMD" will show up.

The CMD prompt generally recognizes two input types: files and folders.

To navigate, type "cd" to "change directory" to the folder you want, and
type "dir" to list the directory contents that you're in.

Running executables in the cmd line generally works like this:

	app.exe filename

Sometimes there are switches called "flags" that are add e.g. /V or -s.
Typing the name of the app without anything else usually brings up a help menu.
Also, the executable and file have to be in the same folder you're in, otherwise
cmd won't recognize what you're referring to (unless you type in the filepath).

If your cmd prompt ever gets stuck you can press Ctrl+C to cancel whatever is running.

===================
Manual UBA Patching
===================

Extract your iso using nodtool. You will need to put nodtool in the same folder as your game for
this to work.

	nodtool.exe -f isoname outputdirectory

Take PakTool.exe and zlib1.dll and put them where all the pak files are inside of the folder
you just made. If you are patching a Gamecube MP2, then the files go inside the "files" folder.
If you are patching Trilogy, then the files go inside \DATA\files\MP2.

Dump lists for paks 1 through 5 with paktool.

	paktool.exe -d Metroid1.pak

Do this for Metroid2.pak through Metroid5.pak. Press the "up" key on the keyboard to cycle
through your command history in CMD, instead of having to re-type everything out.

Extract paks 1 through 5 with paktool.

	paktool.exe -x Metroid1.pak

Do this for Metroid2.pak through Metroid5.pak.

This part will complicated, but necessary. You can do it in Windows, you don't need the
CMD prompt here, but I've typed out commands you can copy and paste in CMD anyway.

You need to be in the folder where all the pak files and folders are you just made.
That is, CMD needs to be in the folder where all the pak files and folders are you just made.
Don't copy the number at the very beginning, I just put that there to help organize the list.
But copy the reste of the line, and paste it into CMD, and run it. Only perform line at a time.

1.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid1-pak\ec6568a0.RULE /V
2.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid1-pak\c24b9fa7.RULE /V
3.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\ec6568a0.RULE /V
4.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\c24b9fa7.RULE /V
5.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\3ba8371a.RULE /V
6.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\42e0c1cb.RULE /V
7.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\437b551b.RULE /V
8.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\e0278e24.RULE /V
9.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\a301c2a4.RULE /V
10.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\a0e14ac6.RULE /V
11.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid2-pak\382c2f8f.RULE /V
12.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid3-pak\ec6568a0.RULE /V
13.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid3-pak\855da32d.RULE /V
14.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid3-pak\c24b9fa7.RULE /V
15.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid4-pak\ec6568a0.RULE /V
16.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid4-pak\7f835cb4.RULE /V
17.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid4-pak\c24b9fa7.RULE /V
18.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid4-pak\836f7cc9.RULE /V
19.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid4-pak\9648f4b4.RULE /V
20.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid4-pak\920ecf81.RULE /V
21.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid5-pak\ec6568a0.RULE /V
22.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid5-pak\7f835cb4.RULE /V
23.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid5-pak\c24b9fa7.RULE /V
24.	XCOPY .\Metroid2-pak\431a3e53.RULE .\Metroid5-pak\920ecf81.RULE /V

There are 24 files you need to copy over. If you mess up, you can go through the list again,
it will be fine. I've left it so prompts will ask you to overwrite each file. Say
"yes" to all of the prompts, but you can use the prompts to scroll back up and check if you've
missed any of the files.

Next, you will need to repack paks 1 through 5.

	paktool.exe -r MP2 Metroid1-pak Metroid1.pak Metroid1-pak.txt

Do this for Metroid2.pak through Metroid5.pak, just replace the numbers as you go, use "up".

Now, in the folder, delete Paktool.exe (or move it back to binmp2) and zlib1.dll.

Delete the Metroid1-pak folders, 1 through 5.
Delete the Metroid1-pak.txt text files (not the .pak files - the text files are much smaller),
Metroid1-pak.txt through Metroid5-pak.txt.

You should have Metroid1.pak through Metroid5.pak still in your folder. This part is done.

Type "cd.." in CMD to go back a folder.

=============
Code Patching
=============

In windows, in the folder you just "cd" to in command, place "xdelta3.exe" and the name
of the patch you want. (If you are patching GCN you should see "files" and "sys", if you are
patching Trilogy you should see "MP1, MP2, MP3...etc".)

Depending on whether you are patching Trilogy or the GC versions, this part varies.

If you want Hardmode 1, you can skip this section (No ammo spawns, but limited ammo) as it
is already complete.

If you want Hardmode2, UBA Keep bars or UBA Remove bars, then you'll need to do this section.

In windows, open up \patchmp2\xdeltamp2 and select the .xdelta patches you want to apply.
Their format is

	<region><type>.xdelta3

Where <region> is USA, EUR, JPN, or USAMPT, and <type> is NBNC, NC, or HM2.

HM2 = Hardmode2
NC = Unlimited Beams, Keep bars
NBNC = Unlimited Beams, Remove bars
USAMPT = Trilogy region

If you are patching Gamecube MP2, you will also need the "Numberless".xdelta3 file with region.
If you are patching Trilogy, you don't need this file.

If you don't select the right region, xdelta3 will give you an error, so it will be difficult
to perform this section wrong.

So for example, if you were patching UBA for Gamecube and removing the ammo bars, you'd want
"usaNBNC.xdelta3" and "usaNumberless.xdelta3". For Trilogy you'd want "usamptNBNC.xdelta3."

=================
Gamecube Patching
=================

Skip this section if you are doing Trilogy patching or you are doing Hardmode1.

Go into \sys and copy "main.dol" into the folder above \sys, where xdelta3.exe is and you are
seeing \sys and \files. Create a patched file with xdelta3 using the .xdelta patch
you selected from \patchmp2\xdeltamp2.

	xdelta3.exe -d -fs main.dol usaNBNC.xdelta3

This will create a .dol file, in this case it will create "usanbnc.dol".

Delete the main.dol you just used and rename usanbnc.dol (or whatever .dol you just created)
to "main.dol". Copy main.dol to \sys, overwriting any files if needed. Create a second copy of
main.dol, this time renaming it "default.dol" and putting it in \files, overwriting if needed.

You can now delete and leftover .dol files in the folder above \sys and \files.

You will now need to do the same thing you did with the .dol, but with Standard.ntwk. It is
located in \files. Make a copy of it to the 'upper' folder, where xdelta3.exe is.

Create another patched file with xdelta using the Numberless xdelta you took
from \patchmp2\xdeltamp2.

	xdelta3.exe -d -fs Standard.xdelta usaNumberless.xdelta3

This will create a .ntwk file, in this case it will create "usaStandard.ntwk."
Delete "Standard.ntwk" and rename "usaStandard.ntwk" to "Standard.ntwk", and then
put that file into \files, overwriting if needed.

Delete any remaining files (xdelta, .dol, etc) in the folder containing \sys and \files.

You are done with this section and can skip to the end.

================
Trilogy Patching
================

Skip this section if you are doing Hardmode1.

Create a patched file with xdelta3 using the patch you selected from \patchmp2\xdeltamp2.

	xdelta3.exe -d -fs rs5mp2_p.dol usamptNBNC.xdelta3

"rs5mp2_p.dol" must be the same, but ".xdelta" should be whatever .xdelta3 patch you picked.

This will create a .dol file, in this case it will create "usamptnbnc.dol".

Delete the rs5mp2_p.dol you just used and rename usamptnbnc.dol (or whatever .dol you just
created) to "rs5mp2_p.dol" to replace it.

Gamecube is a bit more complicated. That's all there is to it for Trilogy.

Delete any remaining files you copied over (xdelta.exe, .xdelta) in the folder containing
the .dol file you just replaced.

You are done with this section and can now go to the end.

======================
The End - Building ISO
======================

Type "cd.." until you get to the top folder that you started all this in. All of the games files
you just patched should be in one folder 'below' you, or whatever folder you're in.

If you're building a Gamecube MP2, the folder structure should look something like so.

->You are here<
             |- gamecubeMP2folder
                    |-files
                    |   |- Metroid1.pak, Metroid2.pak... Standard.ntwk    
                    |
                    |- sys
                        |- main.dol

If you're building a Trilogy MP2, the folder structure should look something like so.

->You are here<
          |- trilogyMP2folder
                 |-DATA
                     |-files
                         |- MP2
                             |- Metroid1.pak, Metroid2.pak... Metroid5.pak
                         |- rs5mp2_p.dol

If you followed the instructions exactly, these files should all be in the right places.

Build an iso with nodtool. If you're building a Gamecube MP2, type

	nodtool.exe makegcn gamefolder gamename.iso

Where gamefolder is the name of the folder with all of the files, and gamename is
"MP2 - Unlimited Beams Authorized (Bars off) (USA).iso" for example. If you use spaces,
you'll need to wrap the filename in quotes.

If you're building a Trilogy MP2, type

	nodtool.exe makewii gamefolder gamename.iso

where the above is all the same, except it's "makewii" instead of "makegcn".

Once nodtool completes, your patch should be completed. You can play your newly created iso
in Dolphin, or by loading onto real hardware (Wii/GC).